/*
 * @Author: your name
 * @Date: 2022-01-04 12:58:03
 * @LastEditTime: 2022-01-04 16:34:30
 * @LastEditors: Please set LastEditors
 * @Description: 打开FileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /c++第13天设计游戏项目实战/c++第13天设计文字游戏项目实战/c++设计大闹天宫最简单的版本1.0无畏之战.cpp
 */

#include <iostream>
#include<string>
//添加list容器的头文件
#include<list>
//添加最大值的头文件
#include <climits>
//添加智能指针的头文件
#include <memory>
using namespace std;

extern "C"
{
    #include <stdlib.h>
    #include <time.h>
    #include <unistd.h>
}


//角色---monkeykong
//设计一个角色类
//转职
class role{
public:
    friend class monkeykong;
    //构造函数，默认值
    role(int blood=60,int strength=8,int spread=5,int level=1,int exp=0)
    {
        this->blood = blood;//血量
        this->strength =strength;//角色力量值
        this->spread = spread;//角色的速度
        this->level = level;//角色的等级
        this->exp = exp;//角色的经验值设计
        this->death = 0;//角色的死亡次数
    }
    void set_nature()//升级加点的设计
    {
        for(int i=4;i>0;)
        {
            cout<<endl<<"当前角色"<<i<<"点升级点，请选择升级的属性"<<endl;
            cout<<"1 血量  2 力量  3 速度（请输入选择升级属性的编号）"<<endl;
            int k;
            cin>>k;
            if(k==1)
            {
                this->blood = this->blood + 15;
                cout<<"当前角色现在血量为："<<this->blood<<endl;
                i--;
            }
            else if(k==2)
            {
                this->strength = this->strength + 1;
                cout<<"当前角色现在力量为："<<this->strength<<endl;
                i--;
            }
            else if(k==3)
            {
                this->spread = this->spread + 2;
                cout<<"你现在速度为："<<this->spread<<endl;
                i--;
            }
            else 
            {
                cout<<"暂时无法为其他技能加点,其他技能点暂未开发"<<endl;
            }
        }
    }

    int attack()//攻击
    {
        //产生一个随机因子
        //将攻击设计成随机性
        srand(time(0));
        //产生随机的 攻击值
        int a=strength+strength*(double)(rand()%10+1)/6;
        for(int i=0;i<10000;i++)
        for(int j=0;j<1000;j++);
        return a;
    }
    int speed()//敏捷
    {
        return spread;
    }
    int get_blood()//血量
    {
        return blood;
    }
    int get_exp(int exp)//获得经验
    {
        this->exp = this->exp + exp + (this->level/2);
        if(this->exp>=this->level*10)
        {
            exp = this->exp - this->level*10;
            this->level++;
            this->exp = exp;
            cout<<endl<<"恭喜你升级成功了"<<endl;
            set_nature();
            if(this->level==10)
            {
                cout<<endl<<"恭喜你，获得新职业成功!!!!!!!!"<<endl<<endl;
                return 1;
            }
        }
        return 0;
    }
    void check()//查看面板
    {
        cout<<"等级："<<level<<endl;
        cout<<"现在经验/升级所需经验："<<exp<<"/"<<level*10<<endl;
        cout<<"血量："<<blood<<endl;
        cout<<"力量："<<strength<<endl;
        cout<<"敏捷："<<spread<<endl;
        cout<<"挑战失败次数"<<death<<endl;
    }
    void death_punishment()//死亡惩罚
    {
        this->blood = this->blood-8;
        this->death++;
        if(this->blood<=0)
        {
            cout<<endl<<"勇者在挑战巨灵神的道路上不断受挫，终于，勇者放弃了冒险"<<endl;
            cout<<"村子里的人都称呼他为失败的勇者"<<endl;
            cout<<"游戏结束"<<endl;
        }
    }
    //查看人物属性
    int check_level()
    {
        return level;
    }

protected:
    int blood;//血量
    int strength;//力量
    int level;//等级
    int exp;//经验
    int spread;//速度
    int death;//挑战失败次数
};

//挑战巫鹰
class hug_yin:public role{
public:
    int get_exp()
    {
        return this->exp;
    }
    hug_yin(int blood=50,int strength=3,int spread=5,int level=1,int exp=5)
    {
        srand(time(0));
        int i=(rand()%10+1)/2;
        this->blood = blood+i*3;
        this->strength =strength+i;
        this->spread = spread+i;
        this->level = level;
        this->exp = exp+i+1;
    }
};

//牛马怪 设计出牛马怪
class horses_blame:public role{
public:
    int get_exp()
    {
        return this->exp;
    }
    horses_blame(int blood=150,int strength=10,int spread=15,int level=5,int exp=30)
    {
        srand(time(0));
        int i=rand()%10+1;
        this->blood = blood+i*10;
        this->strength =strength+i/2;
        this->spread = spread+i;
        this->level = level;
        this->exp = exp+i+5;
    }
    //牛马怪进行攻击
    int horses_blame_attack()
    {
        srand(time(0));
        int a=strength+strength*(double)(rand()%10+1)/6;
        return a*1.5;
    }
};

//巨灵神
class mighty_miracle:public horses_blame{
public:
    mighty_miracle(int blood=600,int strength=23,int spread=20,int level=15,int exp=999)
    {
        srand(time(0));
        int i=rand()%10+1;
        this->blood = blood+i*30;
        this->strength =strength+i/2;
        this->spread = spread+i;
        this->level = level;
        this->exp = exp;
    }
    //巨灵神进行攻击
    int mighty_miracle_attack()
    {
        srand(time(0));
        int a=strength+strength*(double)(rand()%10+1)/6;
        return a*2;
    }
};

//角色派生出来孙悟空
class monkeykong:public role{
public:
   
    void transfer(role &player)//转职
    {
        srand(time(0));
        int i=(rand()%10+1)/2;
        this->blood = player.blood+i*10+50;
        this->strength = player.strength+i+5;
        this->spread = player.spread+i+5;
        this->level = player.level;
        this->exp = player.exp;
        this->death = player.death;
    }
    //牛马怪进行攻击
    int horses_blame_attack()
    {
        srand(time(0));
        int a=strength+strength*(double)(rand()%10+1)/6;//速度
        return a*1.5;
    }
};

//菜单

class action{
public:
    int p_action(role &player)
    {
      {
        
        int i;
         //while(1)
        
             std::cout<<"\t\t\t\t|------------------------------------|"<<std::endl;
             std::cout<<"\t\t\t\t|------------------------------------|"<<std::endl;
             std::cout<<"\t\t\t\t|------------------------------------|"<<std::endl;
             std::cout<<"\t\t\t\t|************************************|"<<std::endl;
             std::cout<<"\t\t\t\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|"<<std::endl;
             std::cout<<"\t\t\t\t|welcome to   大闹天宫之勇者无畏游戏 |"<<std::endl;
             std::cout<<"\t\t\t\t|welcome!!!  welcome!!!    welcome!!!|"<<std::endl;
             std::cout<<"\t\t\t\t|------------------------------------|"<<std::endl;
             std::cout<<"\t\t\t\t|------------------------------------|"<<std::endl;
             std::cout<<"\t\t\t\t|------------------------------------|"<<std::endl;
             std::cout<<"\t\t\t\t|请按ENTER按键进行下一步！！！-------|"<<std::endl;
            sleep(2);
      
           cout<<"选择你的游戏："<<endl;
            cout<<"1.查看角色属性\t"<<"2.挑战巫鹰\t"<<"3.挑战牛马怪\t"<<"4.最终boss巨灵神\t"<<endl;
            cin>>i;
            cout<<endl;
            if(i==1)
            player.check();
            else if(i==2)
            {
                int j=challenge_hug_yin(player);
                if(j==2)
                return 2;
            }
            else if(i==3)
            {
                int j=challenge_horses_blame(player);
                if(j==2)
                return 2;
            }
            else if(i==4)
            cout<<"尚未达到等级，无法挑战巨灵神"<<endl;
            else 
            cout<<"无法识别编号，请重新输入其他编号"<<endl;
            if(player.check_level()>=10)
            return 0;
        }
    }
    //调用
    void p_action(monkeykong &player)
    {
        int i;
        int k=15;
        while(1)
        {
            cout<<endl<<"选择你的游戏："<<endl;
            cout<<"1.查看角色属性\t"<<"2.挑战巫鹰怪\t"<<"3.挑战牛马怪\t"<<"4.最终boss巨灵神\t"<<endl;
            cin>>i;
            cout<<endl;
            if(i==1)
                player.check();
            else if(i==2)
            {
                int j=challenge_hug_yin(player);
                if(j==2)
                break;
            } 
            else if(i==3)
            {
                int j=challenge_horses_blame(player);
                if(j==2)
                break;
            }
            else if(i==4)
            {
                int j=challenge_mighty_miracle(player);
                k--;
                if(k==0)
                {
                    cout<<endl<<"勇者不断的挑战着巨灵神，又不断的失败着，终于，巨灵神在勇者不断的挑战中失去斗志，选择退而不战"<<endl;
                    cout<<"勇者拖着伤残的身体回到村子，虽然巨灵神被击退了 村子里的人都称呼他为“无畏的勇者”"<<endl;
                    cout<<"恭喜通关，游戏结束"<<endl;
                    break;
                }
                if(j==3)
                continue;
                if(j==0)
                {
                    cout<<endl<<"勇者终于战胜了巨灵神，回忆过往，勇者觉得自己的目标不应该止步于此，于是他又踏上了继续其他魔兽的道路上"<<endl;
                    cout<<"村子里将勇者的故事流传开来，他们都称他为“真正的勇者”"<<endl;
                    cout<<"恭喜通关，游戏结束"<<endl;
                    break;
                }
                if(j==2)
                break; 
            }
            else 
            cout<<"无法识别编号，请重新输入其他编号"<<endl;
            if(player.check_level()==25)
            {
                cout<<endl<<"勇者在挑战巨灵神的路上不断修炼，不知不自觉，他的实力已经远远超过巨灵神了"<<endl;
                cout<<"勇者觉得已经没有挑战巨灵神的必要 过回平静的生活,村子里的人都称呼他为“退隐的勇者”"<<endl;
                cout<<"恭喜通关，游戏结束"<<endl;
                break;
            }
        }
    }

private:
    int challenge_hug_yin(role &player)//未转职-->转职之后获得属性
    {
        
        hug_yin enemy;
        //获取速度 和 生命值
        int e_s=enemy.speed();
        int p_s=player.speed();


        
        int e_b=enemy.get_blood();
        int p_b=player.get_blood();

        //战斗的流程
        if(e_s>p_s)
        {
            int times=e_s/p_s;
            while(1)
            {
                for(int i=times;i>0;i--)
                {
                    p_b = p_b-enemy.attack();
                    cout<<"巫鹰使用巫鹰飞袭"<<endl;
                    cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    if(p_b<=0)
                        break;
                }
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(1);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                }
                e_b = e_b-player.attack();
                cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;  
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    player.get_exp(enemy.get_exp());
                    return 0;
                }      
            }
        }
        else
        {
            int times=p_s/e_s;
            while(1)
            {
                for(int i=times;i>0;i--)
                {
                    e_b = e_b-player.attack();
                    cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                    if(e_b<=0)
                        break;
                }
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    player.get_exp(enemy.get_exp());
                    return 0;
                }  
                p_b = p_b-enemy.attack();
                cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(1);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                } 
            }   
        }
    }

  //转职后的战斗流程 ，使用函数重载 静态多态的方式
    //挑战巫鹰怪
    int challenge_hug_yin(monkeykong &player)//已转职
    {
        hug_yin enemy;
        int e_s=enemy.speed();//敌人的速度
        int p_s=player.speed();//玩家的速度
        int e_b=enemy.get_blood();//受伤反馈
        int p_b=player.get_blood();//玩家受伤的反馈
        int p_t=2;//特殊攻击次数
        if(e_s>p_s)//敌人速度快
        {   //比速度
            int times=e_s/p_s;
            while(1)
            {
                for(int i=times;i>0;i--)//攻击次数比
                {
                    p_b = p_b-enemy.attack();
                    cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    if(p_b<=0)
                        break;
                }
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(1);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                }
                if(p_t>0)//普通攻击
                {
                    e_b = 
                    -player.attack();
                    cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                    p_t--;  
                }
                else//特殊攻击
                {
                    e_b = e_b-player.horses_blame_attack();
                    cout<<"你发动特殊攻击"<<endl;
                    cout<<"你造成了"<<player.horses_blame_attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                    p_t=2;//重置特殊攻击次数
                }
                
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    player.get_exp(enemy.get_exp());
                    return 0;
                }
                      
            }
        }
        else//玩家敏捷快
        {
            int times=p_s/e_s;
            while(1)
            {
                for(int i=times;i>0;i--)//攻击次数比
                {
                     if(p_t>0)
                    {
                        e_b = e_b-player.attack();
                        cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                        p_t--;  
                    }
                    else
                    {
                        e_b = e_b-player.horses_blame_attack();
                        cout<<"你发动升龙斩攻击"<<endl;
                        cout<<"你造成了"<<player.horses_blame_attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                        p_t=2;//重置特殊攻击次数
                    }
                    if(e_b<=0)
                        break;
                }
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    player.get_exp(enemy.get_exp());
                    return 0;
                }  
                p_b = p_b-enemy.attack();
                cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(1);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                }    
            }  
        }
    }
    //打第二个boss
    int challenge_horses_blame(monkeykong &player)//已转职
    {
        horses_blame enemy;
        int e_s=enemy.speed();
        int p_s=player.speed();
        int e_b=enemy.get_blood();
        int p_b=player.get_blood();
        int p_t=2;//玩家特殊攻击次数
        int e_t=2;//敌人特殊攻击次数
        if(e_s>p_s)//敌人敏捷快
        {
            int times=e_s/p_s;
            while(1)
            {
                for(int i=times;i>0;i--)//攻击次数比
                {
                    if(e_t>0)//普通攻击
                    {
                        p_b = p_b-enemy.attack();
                        cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                        e_t--;  
                    }
                    else//特殊攻击
                    {
                        p_b = p_b-enemy.horses_blame_attack();
                        cout<<"牛马怪发动勇敢牛马 不怕撞击"<<endl;
                        cout<<"你受到了"<<enemy.horses_blame_attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                        e_t=2;//重置特殊攻击次数
                    }
                    if(p_b<=0)
                        break;
                }
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(1);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                }
                if(p_t>0)//普通攻击
                {
                    e_b = e_b-player.attack();
                    cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                    p_t--;  
                }
                else//特殊攻击
                {
                    e_b = e_b-player.horses_blame_attack();
                    cout<<"你发动升龙斩"<<endl;
                    cout<<"你造成了"<<player.horses_blame_attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                    p_t=2;//重置特殊攻击次数
                }
                
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    player.get_exp(enemy.get_exp());
                    return 0;
                }
                      
            }
        }
        else//玩家速度快
        {
            int times=p_s/e_s;
            while(1)
            {
                for(int i=times;i>0;i--)//攻击次数比
                {
                     if(p_t>0)
                    {
                        e_b = e_b-player.attack();
                        cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                        p_t--;  
                    }
                    else
                    {
                        e_b = e_b-player.horses_blame_attack();
                        cout<<"你发动特殊攻击"<<endl;
                        cout<<"你造成了"<<player.horses_blame_attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                        p_t=2;//重置特殊攻击次数
                    }
                    if(e_b<=0)
                        break;
                }
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    player.get_exp(enemy.get_exp());
                    return 0;
                }  

                if(e_t>0)//普通攻击
                {
                    p_b = p_b-enemy.attack();
                    cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    e_t--;  
                }
                else//特殊攻击
                {
                    p_b = p_b-enemy.horses_blame_attack();
                    cout<<"牛马怪发动勇敢牛马 不怕撞击"<<endl;
                    cout<<"你受到了"<<enemy.horses_blame_attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    e_t=2;//重置特殊攻击次数
                }
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(1);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                }    
            }  
        }
    }
    //挑战牛马怪的过程
    int challenge_horses_blame(role &player)//未转职
    {
        
        horses_blame enemy;
        int e_s=enemy.speed();
        int p_s=player.speed();
        int e_b=enemy.get_blood();
        int p_b=player.get_blood();
        int e_t=2;//敌人特殊攻击次数
        if(e_s>p_s)
        {
            int times=e_s/p_s;
            while(1)
            {
                for(int i=times;i>0;i--)
                {
                   if(e_t>0)//普通攻击
                {
                    p_b = p_b-enemy.attack();
                    cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    e_t--;  
                }
                else//特殊攻击
                {
                    p_b = p_b-enemy.horses_blame_attack();
                    cout<<"牛马怪发动勇敢牛马 不怕撞击"<<endl;
                    cout<<"你受到了"<<enemy.horses_blame_attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    e_t=2;//重置特殊攻击次数
                }
                    if(p_b<=0)
                        break;
                }
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(1);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                }
                e_b = e_b-player.attack();
                cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;  
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    player.get_exp(enemy.get_exp());
                    return 0;
                }      
            }
        }
        else
        {
            int times=p_s/e_s;
            while(1)
            {
                for(int i=times;i>0;i--)
                {
                    e_b = e_b-player.attack();
                    cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                    if(e_b<=0)
                        break;
                }
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    player.get_exp(enemy.get_exp());
                    return 0;
                }  
                if(e_t>0)//普通攻击
                {
                    p_b = p_b-enemy.attack();
                    cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    e_t--;  
                }
                else//特殊攻击
                {
                    p_b = p_b-enemy.horses_blame_attack();
                    cout<<"牛马怪发动特殊攻击"<<endl;
                    cout<<"你受到了"<<enemy.horses_blame_attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    e_t=2;//重置特殊攻击次数
                }
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(1);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                } 
            }   
        }
    }
   //等级够了才能进行挑战巨灵神
    int challenge_mighty_miracle(monkeykong &player)//已转职
    {
        mighty_miracle enemy;
        int e_s=enemy.speed();//敌人的速度
        int p_s=player.speed();//玩家的速度
        int e_b=enemy.get_blood();//敌人受伤反馈
        int p_b=player.get_blood();//玩家受伤反馈
        int p_t=2;//玩家特殊攻击次数
        int e_t=2;//敌人特殊攻击次数
        int e_c_t=2;//敌人必杀攻击次数
        if(e_s>p_s)//敌人敏捷快
        {   
            //获取经验值/速度
            int times=e_s/p_s;
            while(1)
            {
                for(int i=times;i>0;i--)//攻击次数比
                {
                    if(e_t>0)//普通攻击
                    {
                        p_b = p_b-enemy.attack();
                        cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                        e_t--;  
                    }
                    else//特殊技能
                    {
                        p_b = p_b-enemy.horses_blame_attack();
                        cout<<"巨灵神发动螺旋旋风攻击"<<endl;
                        cout<<"你受到了"<<enemy.horses_blame_attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                        e_t=2;//重置特殊攻击次数
                        e_c_t--;
                    }
                    if(e_c_t==0)//必杀攻击
                    {
                        p_b = p_b-enemy.mighty_miracle_attack();
                        cout<<"巨灵神发动螺旋冲击波攻击"<<endl;
                        cout<<"你受到了"<<enemy.mighty_miracle_attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                        e_c_t=2;//重置必杀攻击次数
                    }
                    if(p_b<=0)
                        break;
                }
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(10);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                }
                if(p_t>0)//普通攻击
                {
                    e_b = e_b-player.attack();
                    cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                    p_t--;  
                }
                else//特殊技能攻击
                {
                    e_b = e_b-player.horses_blame_attack();
                    cout<<"你发动升龙斩"<<endl;
                    cout<<"你造成了"<<player.horses_blame_attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                    p_t=2;//重置特殊攻击次数
                }
                
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    return 0;
                }
                      
            }
        }
        else//玩家敏捷快
        {
            int times=p_s/e_s;
            while(1)
            {
                for(int i=times;i>0;i--)//攻击次数比
                {
                     if(p_t>0)
                    {
                        e_b = e_b-player.attack();
                        cout<<"你造成了"<<player.attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                        p_t--;  
                    }
                    else
                    {
                        e_b = e_b-player.horses_blame_attack();
                        cout<<"你发动特殊攻击"<<endl;
                        cout<<"你造成了"<<player.horses_blame_attack()<<"点伤害，敌人剩余"<<e_b<<"点血"<<endl;
                        p_t=2;//重置特殊攻击次数
                    }
                    if(e_b<=0)
                        break;
                }
                if(e_b<=0)
                {
                    cout<<"恭喜你，挑战成功"<<endl;
                    return 0;
                }  

                if(e_t>0)//普通攻击
                {
                    p_b = p_b-enemy.attack();
                    cout<<"你受到了"<<enemy.attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    e_t--;  
                }
                else//特殊攻击
                {
                    p_b = p_b-enemy.horses_blame_attack();
                    cout<<"巨灵神发动特殊攻击"<<endl;
                    cout<<"你受到了"<<enemy.horses_blame_attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    e_t=2;//重置特殊攻击次数
                    e_c_t--;
                }
                if(e_c_t==0)//必杀攻击
                {
                    p_b = p_b-enemy.mighty_miracle_attack();
                    cout<<"巨灵神发动必杀攻击"<<endl;
                    cout<<"你受到了"<<enemy.mighty_miracle_attack()<<"点伤害，剩余"<<p_b<<"点血"<<endl;
                    e_c_t=2;//重置必杀攻击次数
                }
                if(p_b<=0)
                {
                    cout<<"很遗憾，挑战失败"<<endl;
                    player.get_exp(10);
                    player.death_punishment();
                    if(player.get_blood()<=0)
                    return 2;
                    return 3; 
                }    
            }  
        }
    }
};



int main()
{
    role *player = new role;
    action A;
    int j=A.p_action(*player);
    if(j==2)
    return 0;
    monkeykong player_s;

    player_s.transfer(*player);
    delete player;
    A.p_action(player_s);
    void startwelcome_page();
    return 0;
}